# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=catch2
pkgver=2.13.0
pkgrel=0
arch="noarch"
url="https://github.com/catchorg/Catch2"
pkgdesc="A modern, C++-native, header-only, test framework for unit-tests"
license="BSL-1.0"
makedepends="cmake"
checkdepends="python3"
source="https://github.com/catchorg/Catch2/archive/v$pkgver/catch2-v$pkgver.tar.gz"
subpackages="$pkgname-doc"
builddir="$srcdir/Catch2-$pkgver"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# ApprovalTests is broken https://github.com/catchorg/Catch2/issues/1780
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "ApprovalTests"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="07786a9426d9696cd8f9cad14a3d5d00ad507ba6a63699f0cce567b4749d60a25eaf2e469902d8f867f282e2f635021ad6ea38648d69a6316b296b913f7c172d  catch2-v2.13.0.tar.gz"
